package steven.sdc.appPoker.Adapter;

import java.util.ArrayList;

import steven.sdc.appPoker.Fragment.FragmentLichSu;
import steven.sdc.appPoker.Items.ItemNguoiChoi;

import com.amurani.slidingmenu.R;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class AdapterNguoiChoi extends ArrayAdapter<ItemNguoiChoi>{


    private ArrayList<ItemNguoiChoi> Items;
    int layoutId;
    Context frag;
    private LayoutInflater inflater;
    public AdapterNguoiChoi(Context frag, int layoutId, ArrayList<ItemNguoiChoi> list){
		super(frag, R.layout.list_item_nguoichoi1, list);
		this.Items = list;
		this.frag = frag;
		this.layoutId = layoutId;
		
		inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
 
    public View getView(int position, View convertView, ViewGroup parent) {
    	
        convertView = inflater.inflate(R.layout.list_item_nguoichoi1, null);
        ImageView img_matcuoi=(ImageView)convertView.findViewById(R.id.img_matcuoi);
        ImageView img_matmeo = (ImageView)convertView.findViewById(R.id.img_matmeo);
        TextView txt_stt = (TextView) convertView.findViewById(R.id.txt_lichsu_stt);
        TextView txt_ten = (TextView) convertView.findViewById(R.id.txt_lichsu_ten);
        TextView txt_thang = (TextView) convertView.findViewById(R.id.txt_lichsu_thang);
        TextView txt_thua = (TextView) convertView.findViewById(R.id.txt_lichsu_thua);
        TextView txt_tongtran = (TextView) convertView.findViewById(R.id.txt_lichsu_tongtran);
        
        ItemNguoiChoi item = Items.get(position);
 
        img_matcuoi.setImageResource(item.Ic_matcuoi);
        img_matmeo.setImageResource(item.Ic_matmeo);
        txt_stt.setText(""+item.Id);
        txt_ten.setText(""+item.Ten);
        txt_thang.setText(""+item.Thang+" ");
        txt_thua.setText(""+item.Thua+" ");
        txt_tongtran.setText(""+item.Tongtran+" Trận");
        return convertView;
    }
}